package cn.sharp.bbs.entity.BO;

import cn.sharp.bbs.common.page.PageParam;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @className: TaskEntity
 * @description: 任务前后端传递类
 * @author: 王晓崧
 * @date: 2022/7/9
 **/
public class TaskEntity extends PageParam implements Serializable {
    private Long taskID;//任务id
    private Integer score;//任务奖励分值
    private Integer rate;//任务进度
    private String createName;//任务创建者名称
    private String name;//任务名称/描述
    private Integer quota;//任务完成的指标
    private String type;//任务类型
    private double doubleRate;

    public double getDoubleRate() {
        return doubleRate;
    }

    public void setDoubleRate() {
        this.doubleRate = (double)rate/quota;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date time;//任务创建时间
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date stime;//任务开始时间
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date etime;//任务结束时间

    public Long getTaskID() {
        return taskID;
    }

    public void setTaskID(Long taskID) {
        this.taskID = taskID;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getQuota() {
        return quota;
    }

    public void setQuota(Integer quota) {
        this.quota = quota;
    }

    public Date getStime() {
        return stime;
    }

    public void setStime(Date stime) {
        this.stime = stime;
    }

    public Date getEtime() {
        return etime;
    }

    public void setEtime(Date etime) {
        this.etime = etime;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getRate() {
        return rate;
    }

    public void setRate(Integer rate) {
        this.rate = rate;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "TaskEntity{" +
                "rate=" + rate +
                ", time=" + time +
                ", createName='" + createName + '\'' +
                ", name='" + name + '\'' +
                ", quota=" + quota +
                ", stime=" + stime +
                ", etime=" + etime +
                ", type='" + type + '\'' +
                '}';
    }
}
